/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package src;

import java.util.HashMap;
import java.util.Set;
import java.io.*;
import javax.servlet.RequestDispatcher;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class Sair extends HttpServlet{
    
    public void doGet(HttpServletRequest request, HttpServletResponse response){
        processar(request,response);
    }
    public void doPost(HttpServletRequest request, HttpServletResponse response){
        processar(request,response);
    }

    private void processar(HttpServletRequest request, HttpServletResponse response) {
       
        try{
			HttpSession session = request.getSession();
			session.removeAttribute("formAtual");
			session.removeAttribute("expAtual");
			session.removeAttribute("idiAtual");
			session.removeAttribute("cursoAtual");
			session.removeAttribute("aeAtual");
			session.removeAttribute("proAtual");
			session.removeAttribute("userAtual");
			
			String url = "login.jsp";
			
            RequestDispatcher dispatcher = request.getRequestDispatcher(url);
            dispatcher.forward(request, response);
            
        }catch(Exception e){
            e.printStackTrace();
		}
    }
}
